<?php
//Функции
function gcd($a, $b) {
	while ($b != 0) {
		$r = $a%$b;
		$a = $b;
		$b = $r;
	}
	return $a;
}

function swap(&$a, &$b) {
	$t = $a;
	$a = $b;
	$b = $t;
}

$a = 5;
$b = 10;
swap($a, $b);
echo "a = $a b = $b\n";

function hanoi($n, $A, $B, $C) {
	if($n > 0) {
		hanoi($n - 1, $A, $C, $B);
		echo "$A -> $B\n";
		hanoi($n - 1, $C, $B, $A);
	}
}

hanoi(6, "A", "B", "C");

// Глобальные переменные
$A = 10;

function foo() {
	global $A;
	echo $A;
}



	
	
	
	
	
	
	
		